package com.example.springboot01.entity;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * @ConfigurationProperties 将配置文件中每一个属性的值映射到组件中
 * 告诉springboot将配置文件的属性读取为实例对象的属性
 * (prefix = "person")将配置文件中前缀为person的属性读取，并进行一一映射
 * 要使用这个功能必须将此类作为组件，加入spring容器需要加注解@Component
 */

@Data
@ConfigurationProperties(prefix = "person")
@Component
public class Person {
    private String name;
    private Integer age;
    private Boolean boss;
    private Date birthday;

    private Map<String, Object> map;
    private List<Object> list;
    private Dog dog;

}
